# -*- coding=utf-8 -*-
"""
admin model
"""
# from framework.mongomodel import MongoModel
from framework.mongo import MongoModel
import hashlib

class AdminModel(MongoModel):
    """
    admin model login class
    """
    def __init__(self, **kwargs):
        """mongo init connection"""
        super(AdminModel, self).__init__(**kwargs)

    def return_coll(self):
        """return databae name and collection name"""
        return 'fuwa', 'admin'

    def attr(self):
        """
        map attr
        :return: 
        """
        f = {
            "name": ["user_name", u"用户名"],
            "remember": ["remember", u"记住登陆"],
            "pass": ["user_pass", u"密码"]
        }
        return f

    def rules(self):
        """
        model rules
        :return: 
        """
        r = {
            "name": {"min": 4, "max": 20},
            "pass": {"min": 6}
        }
        return r
